<?php
/**
 * @fileoverview    第三方登录用户更新用户信息表 邮箱和密码
 * @author          zhanglei11
 * @date
 * @copyright       sina meila
 */
include_once '../../__global.php';

class aj_updateOtherUser extends ml_controller{

    private $email;
    private $pwd;

    function main() {
            
        $uid = $this->__visitor['uid'];

        // 将用户email 和 密码更新到账号表
        $oAccount = new ml_model_dbUserAccount();
        $rs = $oAccount->updatePwd($uid,$this->pwd,$this->email);

        if($rs) { //成功了就发送邮件,
            $this->loginProxy( modify_login, array('verify_email'=>ML_NOTVERIFY,'email'=>$this->email));
            $this->set_scope_var('$notice',ML_3RD_NOVERIFY);
            $title = $this->__visitor['nickname'].'，欢迎来到美啦！';

            $code = ml_tool_securecode::passport_encrypt($this->email);
            $act_url = SITE_ROOT_URL.'/page/user/active_register.php?code='.$code;
                
            //投放队列
            ml_tool_sendMq::sendMail($this->email , $title , 'register' ,$act_url, $this->__visitor['nickname']);
                
        }else {
            $this->api_output(ML_RCODE_FAIL);
        }

        $this->api_output(ML_RCODE_SUCC);
    }

    function initParam() {
        $this->email = $this->input('email','P');    //用户邮箱
        $this->pwd = $this->input('pwd','P');    //用户密码
    }

    function checkParam() {
        $this->check_referer();
    }

}

new aj_updateOtherUser();

